﻿<!DOCTYPE html>
<!--气体检测管理-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

</head>
<body>
    <div id="app" v-cloak class="popupW150">
        <el-form label-position="right" :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="150px"
                 size="mini">
            <el-row>
                <el-col :span="11">
                    <el-form-item :label="GasDetectionManagement.DetectionTime+mark.m" prop="ArrivalTime">
                        <el-date-picker v-model="Form.TestingcomentList.DetectionTime"
                                        type="datetime"
                                        placeholder="选择日期时间">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="11" :offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.TestingcomentList.DetectionPosition" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{GasDetectionManagement.DetectionPosition+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11">
                    <el-form-item :label="GasDetectionManagement.OxygenConcentration+mark.m" class="inputTextarea">

                        <el-input-number v-model="Form.TestingcomentList.OxygenConcentration" @change="handleChange" :min="1"></el-input-number>
                    </el-form-item>
                </el-col>
                <el-col :span="11" :offset="2">
                    <el-form-item :label="GasDetectionManagement.CombustibleGasConcentrationLEL+mark.m" class="inputTextarea">

                        <el-input-number v-model="Form.TestingcomentList.CombustibleGasConcentrationLEL" @change="handleChange" :min="1"></el-input-number>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-form-item :label="GasDetectionManagement.ToxicGasConcentration+mark.m" class="inputTextarea">
                        <el-input-number v-model="Form.TestingcomentList.ToxicGasConcentration" @change="handleChange" :min="1"></el-input-number>
                    </el-form-item>
                </el-col>
                <el-col :span="11" :offset="2">
                    {{GasDetectionManagement.TesterSignature+mark.m}} <el-button type="primary" @click="">{{col.BtnSignature}}</el-button>
                </el-col>
                <el-col :span="24">
                    <el-form-item :label="GasDetectionManagement.TestConclusion+mark.m" prop="ProcessingOpinion">
                        <el-input type="textarea" v-model="Form.TestingcomentList.TestConclusion" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
    </div>
    <script type="text/javascript">

        var app = new Vue({
            el: '#app',
            data: {
                id: '',
                type: '',
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    DetectionTime: "",
                    DetectionPosition: "",
                    OxygenConcentration: "",
                    CombustibleGasConcentrationLEL: "",
                    ToxicGasConcentration: "",
                    TestConclusion: "",
                    TesterSignature: "",
                    TestingcomentList: [],
                },
                IsConsumables: [],
                //表单验证
                rules: {
                    PersonnelName: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(2, 5), message: verification.StringLengthAtoB.m.format(2, 5), trigger: 'blur' }
                    ],
                    ContractorName: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(5, 50), message: verification.StringLengthAtoB.m.format(5, 10), trigger: 'blur' }
                    ],

                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                handleChange: function (value) {
                    console.log(value);
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            console.log("bbbbbbbbb");
                            console.log(mythis.Form);

                            onSubmitForm(this, '/api/GasDetectionManagement/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getDataAdd: function () {
                    getData(this, '/api/GasDetectionManagement/getAdd?id=' + this.id);
                }
            },
            mounted: function () {
                this.IsConsumables = getDicData('50');
                this.id = getUrlParam("id");            
                this.getDataAdd();
            }
        });
    </script>
</body>

</html>